home *** CD-ROM | disk | FTP | other *** search
/ Champak 43 / Vol 43.iso / games / superdog.swf / scripts / DefineSprite_27_en4 / frame_2 / DoAction.as
Encoding:
Text File  |  2007-06-25  |  2.2 KB  |  97 lines

  1. function jump()
  2. {
  3.    if(canjump == true and dead == false)
  4.    {
  5.       gotoAndStop("Φ╖│");
  6.       play();
  7.       yinc = -10;
  8.       inAir = true;
  9.       canjump = false;
  10.    }
  11. }
  12. stop();
  13. onEnterFrame = function()
  14. {
  15.    if(_parent._parent.pauses == false)
  16.    {
  17.       if(this._x <= 0 and dix == false)
  18.       {
  19.          dix = true;
  20.       }
  21.       else if(this._x >= 580 and dix == true)
  22.       {
  23.          dix = false;
  24.       }
  25.       if(dix == false)
  26.       {
  27.          this._x -= spd;
  28.          long += spd;
  29.          this._xscale = 100;
  30.       }
  31.       else
  32.       {
  33.          this._x += spd;
  34.          long += spd;
  35.          this._xscale = -100;
  36.       }
  37.       if(acted == false and dead == false)
  38.       {
  39.          jump();
  40.          acted = true;
  41.       }
  42.       if(acted == true and dead == false)
  43.       {
  44.          act_i++;
  45.          if(act_i >= 70)
  46.          {
  47.             act_i = 0;
  48.             acted = false;
  49.          }
  50.       }
  51.       var _loc3_ = 0;
  52.       while(_loc3_ < _parent._parent.land_array.length)
  53.       {
  54.          var _loc5_ = _parent[_parent._parent.land_array[_loc3_]];
  55.          if(this.qfk.hitTest(_loc5_) and _loc5_.noWalk == true)
  56.          {
  57.             if(movRight == true)
  58.             {
  59.                this._x += spd;
  60.             }
  61.             if(movLeft == true)
  62.             {
  63.                this._x -= spd;
  64.             }
  65.          }
  66.          _loc3_ = _loc3_ + 1;
  67.       }
  68.       if(inAir == true)
  69.       {
  70.          if(yinc < 10)
  71.          {
  72.             yinc += g;
  73.          }
  74.          this._y += yinc;
  75.          _loc3_ = 0;
  76.          while(_loc3_ < _parent._parent.land_array.length)
  77.          {
  78.             landObject = _parent[_parent._parent.land_array[_loc3_]];
  79.             var _loc4_ = landObject.getBounds(_parent).yMin;
  80.             if(this.dfk.hitTest(landObject))
  81.             {
  82.                if(this._y - yinc < _loc4_)
  83.                {
  84.                   inAir = false;
  85.                   this._y = _loc4_;
  86.                   yinc = 0;
  87.                   canjump = true;
  88.                   gotoAndStop(2);
  89.                   break;
  90.                }
  91.             }
  92.             _loc3_ = _loc3_ + 1;
  93.          }
  94.       }
  95.    }
  96. };
  97.